package com.tosit.driverschool.common.entity;

import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;

@Entity
@Table(name="user")
public class User {

    public User() {
    }

    @Id
    @GenericGenerator(name = "myuuid",strategy = "uuid")
    @GeneratedValue(generator = "myuuid")
   @Column(name="id")
    private String id;

    public User(String id, String name, String password, Date hiredate) {
        this.id = id;
        this.name = name;
        this.password = password;
        this.hiredate = hiredate;
    }

    @Column(name="name")
    private String name;

    private String password;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name="hire_date")
    private Date hiredate;

    public User(int i, String name, String passwowd, Date hiredate) {
    }

    public User(String name, String password) {
        this.name = name;
        this.password = password;
    }

    public String getgetget(){
        return "我就是那么无聊";
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id == null ? null : id.trim();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public Date getHiredate() {
        return hiredate;
    }

    public void setHiredate(Date hiredate) {
        this.hiredate = hiredate;
    }

    @Override
    public String toString() {
        return "User{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", hiredate=" + hiredate +
                '}';
    }
}